package com.srs.backend.controller;

import com.srs.backend.service.FoodService;
import com.srs.backend.utils.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/api/food")
public class FoodController {
    @Resource
    private FoodService foodService;

    @PostMapping("/add/")
    public Result add(@RequestBody Map<String, String> data) {
        return foodService.add(data);
    }

    @PostMapping("/delete/")
    public Result delete(@RequestBody Map<String, String> data) {
        return foodService.delete(data);
    }

    @PostMapping("/modify/")
    public Result modify(@RequestBody Map<String, String> data) {
        return foodService.modify(data);
    }

    @PostMapping("/get/all/")
    public Result getAll() {
        return foodService.getAll();
    }

    @PostMapping("/get/all/producible/")
    public Result getAllProducible() {
        return foodService.getAllProducibleFood();
    }
    @PostMapping("/get/food/by/order/id/")
    public Result getFoodByOrderId(@RequestBody Map<String, String> data) {
        return foodService.getFoodByOrderId(data);
    }
    @PostMapping("/get/chef/all/done/by/period/")
    public Result getChefAllDoneByPeriod(@RequestBody Map<String, String> data) {
        return foodService.getChefAllDoneByPeriod(data);
    }
}
